package com.z6school.manage.common.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = -7798015004719107091L;
    /**记录总数*/
    private Long rowCount;
    /**当前页记录*/
    private List<T> records;
    /**总页数*/
    private Long pageCount;
    /**页面大小*/
    private Integer pageSize;
    /**当前页面值*/
    private Integer pageCurrent;
    public PageObject(Long rowCount, List<T> records, Integer pageSize, Integer pageCurrent) {
        this.rowCount = rowCount;
        this.records = records;
        this.pageSize = pageSize;
        this.pageCurrent = pageCurrent;
        this.pageCount=(rowCount-1)/pageSize+1;
    }
}
